package com.sun.huazhi.aitaskservice.common.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Snowflake 配置类
 */
@Configuration
public class SnowflakeConfig {
    @Value("${snowflake.worker-id:1}")
    private long workerId; // 工作节点ID（0~31）

    @Value("${snowflake.datacenter-id:1}")
    private long datacenterId; // 数据中心ID（0~31）

    @Bean
    public Snowflake snowflake() {
        return new Snowflake(workerId, datacenterId);
    }
}
